<template>
    <div class="con">
        <el-container>
            <el-header>
                <Header></Header>
            </el-header>
            <el-container>
                <el-aside>
                    <Menu></Menu>
                </el-aside>
                <el-main>
                    <router-view></router-view>
                </el-main>
            </el-container>
        </el-container>
    </div>
</template>

<script>
    import Header from '../header/header'
    import Menu from '../header/menu'
    import storage from 'good-storage'
    import {HOST} from"../../common/config"
    export default {
        name: "vue-main",
        components: {
            Header,
            Menu
        },
        data(){
            return{
                form: {
                    userName: 'fwb',
                    password: 'fwb123',
                }
            }
        },
        mounted:function(){
            console.log(storage.get("user"))
            /*this.getUser()*/
        },
        methods:{
            /*getUser(){
                this.$ajax.post(`${HOST}/user/login`,this.form).then((res)=>{
                    console.log(res.data)
                    let result = res.data
                    switch (result.flag){
                        case "0":
                            console.log(result.user)
                            //localStorage.setItem("user",result.user.id);
                            //登录成功,把用户存到localstorage
                            saveUser(result.user)
                            this.$router.push("/main")
                            break;
                        case "1":
                            this.$message("用户名错误");
                            break;
                        case "2":
                            this.$message("密码错误")
                    }
                })
            }*/
        }
    }
</script>

<style scoped>
    .con {

    }

    .el-header {
        background-color: #23262E;
        line-height: 75px;
        height: 75px !important;
        color: #009688;
        padding-left: 2em;
        font-size: 1.3em;
    }
    .el-aside{
        background-color: #545c64;
    }
    .el-menu{
        position: absolute;
        overflow: auto;
        top: 75px;
        left: 0px;
        bottom: 0px;
        width: 300px;
    }
    .el-main{
        position: absolute;
        top: 75px;
        left: 300px;
        bottom: 0px;
        right: 0px;
    }
</style>